capture clear matrix
clear
set more off, permanently
set matsize 11000
set segmentsize 2g
set type double
set maxvar 120000
		 	 
	 cap chdir /home/fanny/Dos/Random_exams/Restat_replication
	
	 global pathdata_processed /home/fanny/Donnees/Projets/Random_exams/Restat_replication
	 global pathdata_processed_cc /home/fanny/Donnees/Projets/Random_exams/Restat_replication/instrument_cc
	
	 global pathdata_education /data/prosjekt/.alfa/education
	 global pathdata_population /data/prosjekt/.alfa/population
	 global pathdata_income /data/prosjekt/.alfa/income
	 global pathdata_labor /data/prosjekt/.alfa/labor
	 global pathdata_public_access /home/fanny/Dos/Random_exams/Restat_replication/Data/Public_access
	 
	 global pathprog_data_construction /home/fanny/Dos/Random_exams/Restat_replication/Programs/Data_construction
	 global pathprog_data_construction_cc /home/fanny/Dos/Random_exams/Restat_replication/Programs/Data_construction/instrument_cc
	 
 	 global pathprog_tables /home/fanny/Dos/Random_exams/Restat_replication/Programs/Tables 
 	 global pathprog_graphs /home/fanny/Dos/Random_exams/Restat_replication/Programs/Graphs 

	 global pathlog /home/fanny/Dos/Random_exams/Restat_replication/Log 	 
	 global pathgraph /home/fanny/Dos/Random_exams/Restat_replication/Outputs 
 	 global pathtable /home/fanny/Dos/Random_exams/Restat_replication/Outputs 
	 
/* DATA */

cd $pathlog
capture log c
log using data_construction, text replace

cd $pathprog_data_construction
do data1.do

cd $pathprog_data_construction
do data2.do

foreach path in pathprog_data_construction pathprog_data_construction_cc { 
	cd $`path'
	do data3a.do

	cd $`path'
	do data3b2005.do

	cd $`path'
	do data3b2006.do

	cd $`path'
	do data3b2007.do

	cd $`path'
	do data3b2008.do

	cd $`path'
	do data3b2009.do

	cd $`path'
	do data3c.do
}

cd $pathprog_data_construction
do data4.do

cd $pathprog_data_construction
do data5.do

log c

/* FIGURES */
cd $pathlog
capture log c
log using results, text replace

cd $pathprog_graphs
do distributions_correlations.do

cd $pathprog_graphs
do monotonicity.do

/* TABLES */
cd $pathprog_tables
do BC.do

cd $pathprog_tables
do main.do

cd $pathprog_tables
do heterogeneity.do

cd $pathprog_tables
do monotonicity.do

cd $pathprog_tables
do robustness.do

cd $pathprog_tables
do IV_OLS_decomposition.do

log c